<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Personal Page</title>
<link rel="stylesheet" type="text/css" href="PersonalPage.css" />
</head>
<%@page import="entities.*"%>
<%@page import="java.util.*"%>
<%
	RegisteredUser user = (RegisteredUser) request.getSession()
			.getAttribute("user");
	List<Declares> userAbilities = (List<Declares>) request
			.getSession().getAttribute("userabilities");
	List<String> systemAbilities = (List<String>) request.getSession()
			.getAttribute("abilities");
	String updateOutcome = (String) request.getSession().getAttribute("updateresult");
%>
<body style="background-color: #94C0D6">
	<img alt="" src="Swim.jpg" style="height: 64px; width: 200px;">
	<form
		style="background-color: #A6B0DB; border-bottom-width: thin; border-right-width: thin; border-left-width: thin; border-top-width: thin; border-top-color: #8080FF; border-right-color: #8080FF; border-top-style: solid; border-right-style: solid; height: 24px;">
		<a href="SearchServlet">Back.</a> <a href="LogOutServlet">Logout.</a>
	</form>
<form style="width: 453px; background-color: #8080FF; height: 22px; vertical-align: middle; border-top-style: solid; border-top-color: #8080C0; border-right-color: #8080C0; border-right-width: thin; border-right-style: solid; border-top-width: thin">
			<center><b><%
				out.print(user.getSurname() + " " + user.getName() + "(alias "
						+ user.getUserId() + ")");
			%></b></center>
</form>
<br>
<br>
<br>
<fieldset style="width: 995px; background-color: #A6B0DB; height: 1015px">
		<div class=field style="width: 276px;">
			<form style="height: 164px; width: 183px; background-color: #A6B0DB; border-top-style: solid; border-top-color: #8080FF; border-right-color: #8080FF; border-right-style: none; border-left-color: #8080FF; border-left-style: solid; border-left-width: thin; border-bottom-color: #8080FF; border-top-width: thin">

				<a href="UpdatePersonalInformation.jsp"><br> Edit Personal
					Info <br></a> 
					<a href="NotificationServlet">View Notifications <br> </a> 
					<a href="SuggestionsServlet">View Friend Suggestions <br></a> 
					<a href="PendingFriendshipServlet">View Friendship Requests <br></a>
				<a href="PendingHelpServlet">View Help Requests <br></a>
								<a href="RequestAbilityServlet">Request New Ability <br></a>
			</form>
		</div>
		<div class=field style="width: 276px;">
		<% if(updateOutcome != null){
			out.println(updateOutcome);
			request.getSession().removeAttribute("updateresult");
			}%>
			<form action="UpdateInformationServlet" class=form-inside method="post"
				style="width: 933px; height: 222px; list-style-type: disc">
				<fieldset style="width: 699px; height: 657px">
					<div class=field style="width: 276px;">
						<table style="height: 83px; width: 256px; background-color: #8080C0">
							<tr>
								<td style="background-color: #8080FF;">Personal Info</td>
							</tr>
							<tr>
								<td><b> New Password:</b></td>
								<td style="width: 245px;"><input type="password"
									name="password"
									style="width: 212px;"></td>
							</tr>
							<tr>
								<td><b> New Name:</b></td>
								<td><input type="text" name="name"
									style="width: 212px;"></td>
							</tr>
							<tr>
								<td><b> New Surname:</b></td>
								<td><input type="text" name="surname"
									style="width: 212px;"></td>
							</tr>
							<tr>
								<td><b> New E-mail:</b></td>
								<td><input type="text" name="e-mail"
									style="width: 212px;"></td>
							</tr>
							<tr>
								<td><b> New Address:</b></td>
								<td><input type="text" name="address"
									style="width: 212px;"></td>
							<tr>
								<td><b> New City:</b></td>
								<td><input type="text" name="town"
									style="width: 212px;"></td>
							<tr>
								<td style="height: 85px;"><b> New Abilities:</b></td>
								<td><b>Ctrl for select</b><br> <br>
								</B><select name="newabilities" id="Select1"
									size="
    								<%if (systemAbilities != null) {
											int length = systemAbilities.size();
											out.print(length);
											} else {
									out.print(0);
									}%>"
									multiple="multiple" style="height: 93px; width: 212px">
										<%
											int i = 0;
											if (systemAbilities != null) {
												for (String ability : systemAbilities) {
													boolean hasAbility = false;
													for (Declares d : userAbilities)
														if ((d.getKey().getAbility().getName()).equals(ability))
															hasAbility = true;
													if (hasAbility)
														out.println("<option selected=true name = \"value\" value=\""
																+ ability + "\">" + ability + "</option>");
													else
														out.println("<option name = \"value\" value=\""
																+ ability + "\">" + ability + "</option>");
													i++;
												}
											}
										%>
								</select></td>
							</tr>
							<tr>
								<td><input type="submit" value="Apply Change" style="background-color: #8080FF"></td>
							</tr>
						</table>
					</div>
				</fieldset>
			</form>
		</div>
	</fieldset>